package com.itcam.interview.pro01javase;

import java.util.HashSet;

/**
 * @author : Cammy.Wu
 * Description : 
 */

public class Demo03HashCode {
    public static void main(String[] args) {
//        System.out.println("Aa".hashCode());
//        System.out.println("BB".hashCode());

        HashSet<Integer> hashSet = new HashSet<>();

        for (int i = 1; i <= 20 * 10000; i++) {
            int hashCode = new Book().hashCode();
            if (!hashSet.contains(hashCode)) {
                hashSet.add(hashCode);
            } else {
                System.out.println("发送了哈希冲突，在第" + i + "次，值是：" + hashCode);
            }
        }
        System.out.println(hashSet.size());
    }
}

class Book {
    int id;
}